package com.example.androidmainshixun.view;

import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;

import com.example.androidmainshixun.R;

public class ActivityPassEdit extends AppCompatActivity {

    private ActivityPassEditFragment activityPassEditFragment;
    private Fragment mContentFragment;
    private FragmentManager mFragmentManager;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_pass_edit);

        mFragmentManager = getSupportFragmentManager();

        activityPassEditFragment=new ActivityPassEditFragment();
        showFragment(new ActivityPassEditFragment());
    }
    public void showFragment(Fragment fragment) {
        if (fragment != null && mContentFragment != fragment) {
            FragmentTransaction transaction=mFragmentManager.beginTransaction();
            if (mContentFragment != null) {
                transaction.hide(mContentFragment);
            }
            transaction.add(R.id.pass_edit,fragment);
            transaction.commit();
            mContentFragment = fragment;
        }
    }

}
